// 引入express框架
var express = require('express');
// 创建路由对象
var router = express.Router();
// 引入用户、角色、菜单数据模型
let userModel = require('../db/user');
let roleModel = require('../db/role');
let menuModel = require('../db/menu');

/* GET home page. */
// 首页路由，渲染index页面
router.get('/', function (req, res, next) {
    res.render('index', { title: 'Express' });
});

// 注册
router.post('/register', async function (req, res, next) {
    const { username, password, dep, node } = req.body
    if (username && password) {
        const year = new Date().getFullYear();
        const month = String(new Date().getMonth() + 1).padStart(2,'0')
        const days = new Date().getDay().padStart(2,'0')
        let jobNumber = '1001' + dep + year + month + days
        console.log(jobNumber);
    }

});




// 导出路由对象
module.exports = router;